cmake_policy(SET CMP0076 NEW)

target_sources(gmcore PRIVATE
  albedo_mod.F90
  cam_physics_types_mod.F90
  cam_physics_objects_mod.F90
  cam_physics_output_mod.F90
  cam_physics_driver_mod.F90
  cam/aer_rad_props.F90
  cam/aoa_tracers.F90
  cam/beljaars_drag_cam.F90
  cam/beljaars_drag.F90
  cam/boundarydata.F90
  cam/cam_diagnostics.F90
  cam/cam3_aero_data.F90
  cam/cam3_ozone_data.F90
  cam/carma_flags_mod.F90
  cam/carma_intr.F90
  cam/carma_model_flags_mod.F90
  cam/check_energy.F90
  cam/chem_surfvals.F90
  cam/cldfrc2m.F90
  cam/cldwat.F90
  cam/cldwat2m_macro.F90
  cam/cloud_cover_diags.F90
  cam/cloud_diagnostics.F90
  cam/cloud_fraction.F90
  cam/clubb_intr.F90
  cam/cmparray_mod.F90
  cam/co2_cycle.F90
  cam/co2_data_flux.F90
  cam/constituent_burden.F90
  cam/constituents.F90
  cam/conv_water.F90
  cam/convect_deep.F90
  cam/convect_shallow.F90
  cam/cospsimulator_intr.F90
  cam/cpslec.F90
  cam/dadadj_cam.F90
  cam/dadadj.F90
  cam/diffusion_solver.F90
  cam/eddy_diff_cam.F90
  cam/eddy_diff.F90
  cam/flux_avg.F90
  cam/geopotential.F90
  cam/ghg_data.F90
  cam/gw_common.F90
  cam/gw_convect.F90
  cam/gw_diffusion.F90
  cam/gw_drag.F90
  cam/gw_front.F90
  cam/gw_oro.F90
  cam/gw_rdg.F90
  cam/gw_utils.F90
  cam/hb_diff.F90
  cam/hetfrz_classnuc_cam.F90
  cam/hetfrz_classnuc.F90
  cam/hk_conv.F90
  cam/iondrag.F90
  cam/lunar_tides.F90
  cam/macrop_driver.F90
  cam/micro_mg_cam.F90
  cam/microp_aero.F90
  cam/microp_driver.F90
  cam/modal_aer_opt.F90
  cam/molec_diff.F90
  cam/ndrop_bam.F90
  cam/ndrop.F90
  cam/nucleate_ice_cam.F90
  cam/nucleate_ice.F90
  cam/pbl_utils.F90
  cam/phys_control.F90
  cam/phys_debug_util.F90
  cam/phys_debug.F90
  cam/phys_gmean.F90
  cam/phys_grid.F90
  cam/phys_prop.F90
  cam/physics_buffer.F90
  cam/physics_types.F90
  cam/physpkg.F90
  cam/pkg_cld_sediment.F90
  cam/pkg_cldoptics.F90
  cam/polar_avg.F90
  cam/ppgrid.F90
  cam/qbo.F90
  cam/qneg_module.F90
  cam/rad_constituents.F90
  cam/radheat.F90
  cam/radiation_data.F90
  cam/rayleigh_friction.F90
  cam/ref_pres.F90
  cam/rk_stratiform.F90
  cam/sslt_rebin.F90
  cam/subcol_pack_mod.F90
  cam/subcol_SILHS.F90
  cam/subcol_tstcp.F90
  cam/subcol_utils.F90
  cam/subcol.F90
  cam/tidal_diag.F90
  cam/tracers_suite.F90
  cam/trb_mtn_stress_cam.F90
  cam/trb_mtn_stress.F90
  cam/tropopause.F90
  cam/unicon_cam.F90
  cam/uwshcu.F90
  cam/vdiff_lu_solver.F90
  cam/vertical_diffusion.F90
  cam/waccmx_phys_intr.F90
  cam/wv_sat_methods.F90
  cam/wv_saturation.F90
  cam/zm_conv_intr.F90
  cam/zm_conv.F90
  cam/zm_microphysics.F90
  control/cam_control_mod.F90
  control/cam_history_buffers.F90
  control/cam_history_support.F90
  control/cam_history.F90
  control/cam_initfiles.F90
  control/cam_instance.F90
  control/cam_logfile.F90
  control/camsrfexch.F90
  control/filenames.F90
  control/ncdio_atm.F90
  control/runtime_opts.F90
  control/sat_hist.F90
  dycore.F90
  dyn_comp.F90
  dyn_grid.F90
  pmgrid.F90
  pumas/micro_mg1_0.F90
  pumas/micro_mg3_0.F90
  pumas/micro_pumas_data.F90
  pumas/micro_pumas_utils.F90
  rrtmg/aer_src/mcica_subcol_gen_lw.f90
  rrtmg/aer_src/mcica_subcol_gen_sw.f90
  rrtmg/aer_src/parrrsw.f90
  rrtmg/aer_src/parrrtm.f90
  rrtmg/aer_src/rrlw_con.f90
  rrtmg/aer_src/rrlw_kg01.f90
  rrtmg/aer_src/rrlw_kg02.f90
  rrtmg/aer_src/rrlw_kg03.f90
  rrtmg/aer_src/rrlw_kg04.f90
  rrtmg/aer_src/rrlw_kg05.f90
  rrtmg/aer_src/rrlw_kg06.f90
  rrtmg/aer_src/rrlw_kg07.f90
  rrtmg/aer_src/rrlw_kg08.f90
  rrtmg/aer_src/rrlw_kg09.f90
  rrtmg/aer_src/rrlw_kg10.f90
  rrtmg/aer_src/rrlw_kg11.f90
  rrtmg/aer_src/rrlw_kg12.f90
  rrtmg/aer_src/rrlw_kg13.f90
  rrtmg/aer_src/rrlw_kg14.f90
  rrtmg/aer_src/rrlw_kg15.f90
  rrtmg/aer_src/rrlw_kg16.f90
  rrtmg/aer_src/rrlw_ref.f90
  rrtmg/aer_src/rrlw_tbl.f90
  rrtmg/aer_src/rrlw_wvn.f90
  rrtmg/aer_src/rrsw_con.f90
  rrtmg/aer_src/rrsw_kg16.f90
  rrtmg/aer_src/rrsw_kg17.f90
  rrtmg/aer_src/rrsw_kg18.f90
  rrtmg/aer_src/rrsw_kg19.f90
  rrtmg/aer_src/rrsw_kg20.f90
  rrtmg/aer_src/rrsw_kg21.f90
  rrtmg/aer_src/rrsw_kg22.f90
  rrtmg/aer_src/rrsw_kg23.f90
  rrtmg/aer_src/rrsw_kg24.f90
  rrtmg/aer_src/rrsw_kg25.f90
  rrtmg/aer_src/rrsw_kg26.f90
  rrtmg/aer_src/rrsw_kg27.f90
  rrtmg/aer_src/rrsw_kg28.f90
  rrtmg/aer_src/rrsw_kg29.f90
  rrtmg/aer_src/rrsw_ref.f90
  rrtmg/aer_src/rrsw_tbl.f90
  rrtmg/aer_src/rrsw_wvn.f90
  rrtmg/aer_src/rrtmg_lw_init.f90
  rrtmg/aer_src/rrtmg_lw_k_g.f90
  rrtmg/aer_src/rrtmg_lw_rad.f90
  rrtmg/aer_src/rrtmg_lw_rtrnmc.f90
  rrtmg/aer_src/rrtmg_lw_setcoef.f90
  rrtmg/aer_src/rrtmg_lw_taumol.f90
  rrtmg/aer_src/rrtmg_sw_cldprmc.f90
  rrtmg/aer_src/rrtmg_sw_init.f90
  rrtmg/aer_src/rrtmg_sw_k_g.f90
  rrtmg/aer_src/rrtmg_sw_rad.f90
  rrtmg/aer_src/rrtmg_sw_reftra.f90
  rrtmg/aer_src/rrtmg_sw_setcoef.f90
  rrtmg/aer_src/rrtmg_sw_spcvmc.f90
  rrtmg/aer_src/rrtmg_sw_taumol.f90
  rrtmg/aer_src/rrtmg_sw_vrtqdr.f90
  rrtmg/cloud_rad_props.F90
  rrtmg/ebert_curry.F90
  rrtmg/oldcloud.F90
  rrtmg/rad_solar_var.F90
  rrtmg/radconstants.F90
  rrtmg/radiation.F90
  rrtmg/radlw.F90
  rrtmg/radsw.F90
  rrtmg/rrtmg_state.F90
  rrtmg/slingo.F90
  shr/dSFMT_interface.F90
  shr/dSFMT.c
  shr/dSFMT_utils.c
  shr/kissvec_mod.F90
  shr/mersennetwister_mod.F90
  shr/seq_drydep_mod.F90
  shr/shr_abort_mod.F90
  shr/shr_assert_mod.F90
  shr/shr_cal_mod.F90
  shr/shr_const_mod.F90
  shr/shr_expr_parser_mod.F90
  shr/shr_file_mod.F90
  shr/shr_fire_emis_mod.F90
  shr/shr_flux_mod.F90
  shr/shr_infnan_mod.F90
  shr/shr_kind_mod.F90
  shr/shr_log_mod.F90
  shr/shr_megan_mod.F90
  shr/shr_mpi_mod.F90
  shr/shr_ncread_mod.F90
  shr/shr_nl_mod.F90
  shr/shr_orb_mod.F90
  shr/shr_pio_mod.F90
  shr/shr_RandNum_mod.F90
  shr/shr_reprosum_mod.F90
  shr/shr_reprosumx86.c
  shr/shr_spfn_mod.F90
  shr/shr_strconvert_mod.F90
  shr/shr_string_mod.F90
  shr/shr_sys_mod.F90
  shr/shr_timer_mod.F90
  unit_drivers/drv_input_data.F90
  utils/air_composition.F90
  utils/bnddyi.F90
  utils/buffer.F90
  utils/cam_abortutils.F90
  utils/cam_datetime.F90
  utils/cam_grid_support.F90
  utils/cam_interp_mod.F90
  utils/cam_map_utils.F90
  utils/cam_pio_utils.F90
  utils/coords_1d.F90
  utils/dyn_tests_utils.F90
  utils/error_messages.F90
  utils/gmean_mod.F90
  utils/infnan.F90
  utils/interpolate_data.F90
  utils/intp_util.F90
  utils/ioFileMod.F90
  utils/linear_1d_operators.F90
  utils/mct_mod.F90
  utils/mpishorthand.F
  utils/namelist_utils.F90
  utils/orbit.F90
  utils/physconst.F90
  utils/spmd_utils.F90
  utils/srf_field_check.F90
  utils/string_utils.F90
  utils/time_manager.F90
  utils/units.F90
  utils/water_isotopes.F90
  utils/wrap_mpi.F90
)

if (USE_CLUBB_SGS)
  message(STATUS "Using CLUBB SGS")
  target_sources(gmcore PRIVATE
    clubb/adg1_adg2_3d_luhar_pdf.F90
    clubb/advance_clubb_core_module.F90
    clubb/advance_helper_module.F90
    clubb/advance_windm_edsclrm_module.F90
    clubb/advance_wp2_wp3_module.F90
    clubb/advance_xm_wpxp_module.F90
    clubb/advance_xp2_xpyp_module.F90
    clubb/advance_xp3_module.F90
    clubb/array_index.F90
    clubb/calc_pressure.F90
    clubb/calc_roots.F90
    clubb/calendar.F90
    clubb/clip_explicit.F90
    clubb/clip_semi_implicit.F90
    clubb/clubb_api_module.F90
    clubb/clubb_precision.F90
    clubb/constants_clubb.F90
    clubb/corr_varnce_module.F90
    clubb/diagnose_correlations_module.F90
    clubb/diffusion.F90
    clubb/endian.F90
    clubb/error_code.F90
    clubb/file_functions.F90
    clubb/fill_holes.F90
    clubb/grid_class.F90
    clubb/hydromet_pdf_parameter_module.F90
    clubb/index_mapping.F90
    clubb/input_names.F90
    clubb/input_reader.F90
    clubb/interpolation.F90
    clubb/lapack_interfaces.F90
    clubb/lapack_wrap.F90
    clubb/LY93_pdf.F90
    clubb/matrix_operations.F90
    clubb/mean_adv.F90
    clubb/mixing_length.F90
    clubb/model_flags.F90
    clubb/mono_flux_limiter.F90
    clubb/mt95.f90
    clubb/Nc_Ncn_eqns.F90
    clubb/new_hybrid_pdf_main.F90
    clubb/new_hybrid_pdf.F90
    clubb/new_pdf_main.F90
    clubb/new_pdf.F90
    clubb/new_tsdadg_pdf.F90
    clubb/numerical_check.F90
    clubb/output_grads.F90
    clubb/parameter_indices.F90
    clubb/parameters_model.F90
    clubb/parameters_tunable.F90
    clubb/pdf_closure_module.F90
    clubb/pdf_parameter_module.F90
    clubb/pdf_utilities.F90
    clubb/pos_definite_module.F90
    clubb/precipitation_fraction.F90
    clubb/saturation.F90
    clubb/setup_clubb_pdf_params.F90
    clubb/sigma_sqd_w_module.F90
    clubb/Skx_module.F90
    clubb/sponge_layer_damping.F90
    clubb/stat_file_module.F90
    clubb/stats_clubb_utilities.F90
    clubb/stats_lh_sfc_module.F90
    clubb/stats_lh_zt_module.F90
    clubb/stats_rad_zm_module.F90
    clubb/stats_rad_zt_module.F90
    clubb/stats_sfc_module.F90
    clubb/stats_type_utilities.F90
    clubb/stats_type.F90
    clubb/stats_variables.F90
    clubb/stats_zm_module.F90
    clubb/stats_zt_module.F90
    clubb/surface_varnce_module.F90
    clubb/T_in_K_module.F90
    clubb/turbulent_adv_pdf.F90
    clubb/variables_diagnostic_module.F90
    clubb/variables_prognostic_module.F90
  )
endif ()
